import 'dart:convert';

import 'package:largefriends/entity/json/json_parse_utils.dart';

class LfLimitEntity {
  LfLimitEntity({
    this.curLikeCnt = 0,
    this.curSparkCnt = 0,
    this.curWinkCnt = 0,
    this.likeLimit = 0,
    this.remainTime = 0,
    this.sparkLimit = 0,
    this.winkLimit = 0,
  });

  factory LfLimitEntity.fromJson(Map<String, dynamic> jsonRes) => LfLimitEntity(
        curLikeCnt: jsonRes.asInt('curLikeCnt', 0),
        curSparkCnt: jsonRes.asInt('curSparkCnt', 0),
        curWinkCnt: jsonRes.asInt('curWinkCnt', 0),
        likeLimit: jsonRes.asInt('likeLimit', 10000),
        remainTime: jsonRes.asInt('remainTime', 0),
        sparkLimit: jsonRes.asInt('sparkLimit', 10000),
        winkLimit: jsonRes.asInt('winkLimit', 10000),
      );

  int curLikeCnt;
  int curSparkCnt;
  int curWinkCnt;
  int likeLimit;
  int remainTime;
  int sparkLimit;
  int winkLimit;

  @override
  String toString() {
    return jsonEncode(this);
  }

  Map<String, dynamic> toJson() => <String, dynamic>{
        'curLikeCnt': curLikeCnt,
        'curSparkCnt': curSparkCnt,
        'curWinkCnt': curWinkCnt,
        'likeLimit': likeLimit,
        'remainTime': remainTime,
        'sparkLimit': sparkLimit,
        'winkLimit': winkLimit,
      };
}
